package cn.yunhe.dao.impl;

import cn.yunhe.dao.IAccountDao;
import cn.yunhe.entity.Account;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Component;

import java.util.List;

public class AccountDao extends HibernateDaoSupport implements IAccountDao {

    @Override
    public Account get(int aid) {
        return getHibernateTemplate().get(Account.class, aid);
    }

    @Override
    public void addAccount(Account account) {
        getHibernateTemplate().save(account);
    }

    @Override
    public void delAccount(int aid) {
        getHibernateTemplate().delete(get(aid));
    }

    @Override
    public void updateAccount(Account account) {
        getHibernateTemplate().update(account);
    }

    @Override
    public List<Account> searchAll(String hql) {
        return getHibernateTemplate().find(hql);
    }
}
